package rs.udd.service.dto.advert;

import javax.validation.constraints.NotNull;

import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

public class AdvertDto {
	
	private Long id;
	
	@NotNull
	private String title;

	@NotNull
	private String abstractText;
	
	private String metaAuthor;
	
	private String metaTitle;

	private String metaKeywords;
	
	private CommonsMultipartFile file;
	
	@NotNull
	private String categoryNames;
	
	public AdvertDto() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAbstractText() {
		return abstractText;
	}

	public void setAbstractText(String abstractText) {
		this.abstractText = abstractText;
	}

	public String getMetaAuthor() {
		return metaAuthor;
	}

	public void setMetaAuthor(String metaAuthor) {
		this.metaAuthor = metaAuthor;
	}

	public String getMetaTitle() {
		return metaTitle;
	}

	public void setMetaTitle(String metaTitle) {
		this.metaTitle = metaTitle;
	}

	public String getMetaKeywords() {
		return metaKeywords;
	}

	public void setMetaKeywords(String metaKeywords) {
		this.metaKeywords = metaKeywords;
	}

	public CommonsMultipartFile getFile() {
		return file;
	}

	public void setFile(CommonsMultipartFile file) {
		this.file = file;
	}

	public String getCategoryNames() {
		return categoryNames;
	}

	public void setCategoryNames(String categoryNames) {
		this.categoryNames = categoryNames;
	}
	
	public boolean isEmpty() {
		if (this.getMetaAuthor() == null) {
			return true;
		}
		if (this.getMetaTitle() == null) {
			return true;
		}
		if (this.getMetaKeywords() == null) {
			return true;
		}
		if (StringUtils.isEmpty(getCategoryNames())) {
			return true;
		}

		return false;

	}
	
	public boolean isNotEmpty() {
		return !isEmpty();
	}

}
